package com.funtl.framework.java.common.util.bean;


/**
 * 通用排序工具
 * @author lwm
 *
 */
public class Sort {
	/**
	 * 正序排序
	 * @param array
	 */
	public static void sortArrayA(long[] array) {
		int in, out;
		for (out = 1 ; out < array.length ; out++) {
			long temp = array[out];
			in = out;
			while (in > 0 && array[in - 1] >= temp) {
				array[in] = array[in - 1];
				--in;
			}
			array[in] = temp;
		}
	}
	
	/**
	 * 倒序排序
	 * @param array
	 * @return
	 */
	public static void sortArrayD(long[] array) {
		int in, out;
		for (out = 1 ; out < array.length ; out++) {
			long temp = array[out];
			in = out;
			while (in > 0 && array[in - 1] <= temp) {
				array[in] = array[in - 1];
				--in;
			}
			array[in] = temp;
		}
	}
}
